import { ApiProperty } from '@nestjs/swagger';
import { PaymentMethod } from './payment.service';
import { IsDecimal, IsEnum, IsInt, IsNotEmpty, Min,IsString,IsOptional } from 'class-validator';

export class CreatePaymentDto {
  @ApiProperty({
    description: '订单ID',
    example: 12345,
    minimum: 1
  })
  @IsInt()
  @IsNotEmpty()
  orderId: number;

  @ApiProperty({
    description: '支付金额',
    example: 100.5,
    minimum: 0.01,
    maximum: 1000000
  })
  @IsDecimal({ decimal_digits: '2' })
  @Min(0.01)
  amount: number;

  @ApiProperty({
    description: '支付方式',
    enum: PaymentMethod,
    example: PaymentMethod.ALIPAY
  })
  @IsEnum(PaymentMethod)
  method: PaymentMethod;

  @ApiProperty({
    description: '支付货币',
    example: 'CNY',
    default: 'CNY'
  })
  @IsString()
  @IsOptional()
  currency?: string;
}
